import { post, get } from '@/utils/request'

// 创建用户
export const fetchCreateAccount = async (params) => {
  return await post('/api/admin/account/create', params)
}

// 编辑用户
export const fetchUpdateAccount = async (params) => {
  return await post('/api/admin/account/update', params)
}

// 编辑用户
export const fetchAccountDetail = async (params) => {
  return await get(`/api/admin/account/detail`, params)
}

// 用户列表
export const fetchAccountList = async (params) => {
  return await post(`/api/admin/account/list?page_size=${params.page_size}&page_num=${params.page_num}`, params)
}

// 重置密码、更新密码
export const fetchUpdatePwd = (params) =>
  post('/api/admin/account/update_password', params)

// 创建部门
export const createDept = async (params) => {
  return await post('/api/admin/account/create_dept', params)
}

// 编辑部门
export const updateDept = async (params) => {
  return await post('/api/admin/account/update_dept', params)
}

// 部门列表
export const getDeptList = async (params) => {
  return await post('/api/admin/account/get_dept_list', params)
}

// 平台权限管理列表
export const getUserMenuDetail = async (params) => {
  return await post('/api/admin/menu/get_user_menu_detail', params)
}

// 平台权限管理列表 所有平台
export const getAllMenuList = async (params) => {
  return await post('/api/admin/menu/get_all_menu_list', params)
}

// 编辑平台权限
export const updateMenuDetail = async (params) => {
  return await post('/api/admin/menu/save_user_menu_detail', params)
}

// 编辑平台权限
export const updateUserMenuDetail = async (params) => {
  return await post('/api/admin/menu/update_user_menu_detail', params)
}
